<?php $this->_extends('../_layouts/default_layout'); ?>
<?php $this->_block('contents'); ?>
<script src="<?=Q::ini('custom_system/base_url');?>js/json.js"></script>
<script type="text/javascript">
$(function(){
	var old_info;
	$(".edit").click(function(){
		var container = $(this).parent().parent();
		old_info = container.find("input.blur").val();
		container.find("input.blur").focus().blur(function(){
			var currency_id = $(this).next().val();
			var new_info = $(this).val();
			if (new_info != old_info)
			{
				if ($(this).attr("name") == 'rate')
				{
					var url = "<?=url('Setting::Basic/CurrencyEditSave')?>&rate=" + new_info;
				}
				$.ajax({
					url: url + "&currency_id=" + currency_id,
					type: "GET",
					dataType: "json",
					success:
						function(data)
						{
							current_tag.addClass("blur");
						}
				});
			}
		});
	});
});
</script>
<style>
.blur
{
	cursor: pointer;
	border: none;
}
</style>
<table class="list_table" width="100%">
<tr>
	<th>代码</th>
	<th>符号</th>
	<th>名称</th>
	<th>汇率</th>
	<th>是否是本地币</th>
	<th width="50">操作</th>
</tr>
<?foreach ($currency as $c):?>
<tr>
	<td><?=$c['code']?></td>
	<td><?=$c['symbol']?></td>
	<td><?=$c['desc']?></td>
	<td>
		<input type="text" name="rate" value="<?=$c['rate']?>" size="10" class="blur" />
		<input type="hidden" value="<?=$c['id']?>" />
	
	</td>
	<td><?=($c['is_default']==1) ? '是' : '否 '?></td>
	<td><a class="edit">修改</a></td>
</tr>
<?endforeach;?>
</table>
<?php $this->_endblock();?>